import { ipcRenderer } from 'electron-better-ipc'
import { IWorkSpaceHistoryItem } from './interfaces'

// 读取历史记录数据
export const readWorkSpaceHistory = async () => {
    return await ipcRenderer.callMain<void, IWorkSpaceHistoryItem[]>('readWorkSpaceHistory')
}

// 更新最后访问事件
export const updateWorkSpaceAccessTime = async (id: string) => {
    return await ipcRenderer.callMain('updateWorkSpaceAccessTime', id)
}

// 保存
export const saveWorkSpaceHistory = async (data: IWorkSpaceHistoryItem[]) => {
    return await ipcRenderer.callMain('saveWorkSpaceHistory', data)
}
